﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:converter="clr-namespace:Neudesic.Pulse.Converters"
                    xmlns:controls="clr-namespace:Neudesic.Pulse.Controls">

    <converter:VisibilityConverter x:Key="VisibilityConverter" />
    <converter:VisibilityConverter x:Key="NegativeVisibilityConverter" Negative="True" />
    <converter:CollectionCountVisibilityConverter x:Key="CollectionCountVisibilityConverter" />
    <converter:UriToBitmapImageConverter x:Key="UriToBitmapImageConverter" />
    <converter:LikeConverter x:Key="LikeConverter" />
    <converter:VoteColorConverter x:Key="VoteColorConverter" />

    <BitmapImage x:Key="DocumentImage" UriSource="../Images/document.png" />
    
    <LinearGradientBrush x:Key="ErrorBrush" StartPoint="0,0.5" EndPoint="1,0.5">
        <GradientStop Color="Red" Offset="0.0" />
        <GradientStop Color="Pink" Offset="1.0" />
    </LinearGradientBrush>

    <Style x:Key="Timestamp" TargetType="TextBlock">
        <Setter Property="FontSize" Value="10" />
        <Setter Property="Foreground" Value="#8ECAD3" />
    </Style>

    <Style x:Key="waterMarkedTextBox" TargetType="{x:Type TextBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid>
                        <Border x:Name="BorderBase" Background="White" BorderThickness="1.4,1.4,1,1" 
                            BorderBrush="Silver" CornerRadius="2" />
                        <Label x:Name="TextPrompt" Content="{TemplateBinding Tag}" Visibility="Collapsed" Focusable="False" Foreground="Silver" />
                        <ScrollViewer Margin="0" x:Name="PART_ContentHost" Foreground="{DynamicResource OutsideFontColor}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="False"></Condition>
                                <Condition Property="Text" Value=""></Condition>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter Property="Visibility" TargetName="TextPrompt" Value="Visible"></Setter>
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="BorderThickness" TargetName="BorderBase" Value="2.4,2.4,1,1"></Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="DimGray" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type controls:LinkLabel}"
         BasedOn="{StaticResource {x:Type Label}}">
        <Setter Property="Foreground" Value="Blue"/>
        <Setter Property="HoverForeground" Value="Red"/>

        <Setter Property="HyperlinkStyle">
            <Setter.Value>
                <Style TargetType="Hyperlink">
                    <Setter Property="Foreground" Value="{Binding RelativeSource=
                      {RelativeSource TemplatedParent}, Path=Foreground}"/>
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Foreground"
                      Value="{Binding RelativeSource=
                      {RelativeSource TemplatedParent}, Path=HoverForeground}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground"
                        Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Setter.Value>
        </Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:LinkLabel}">
                    <Border Background="{TemplateBinding Background}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  Padding="{TemplateBinding Padding}"
                  SnapsToDevicePixels="true">
                        <TextBlock Background="{TemplateBinding Background}"
                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                       SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
              <Hyperlink
                x:Name="PART_InnerHyperlink"
                NavigateUri="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=Url}"
                Style= "{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=HyperlinkStyle}"
                Command="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=Command}"
                CommandParameter="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=CommandParameter}"
                CommandTarget="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=CommandTarget}"
                IsEnabled="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=IsEnabled}">
                  <Run Text="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=Content}"/>
              </Hyperlink>
                        </TextBlock>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="LinkLabelBehavior" Value="NeverUnderline">
                            <Setter TargetName="PART_InnerHyperlink" Property="TextDecorations"  Value="None"/>
                        </Trigger>
                        <Trigger Property="LinkLabelBehavior" Value="AlwaysUnderline">
                            <Setter TargetName="PART_InnerHyperlink" Property="TextDecorations" Value="Underline"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true"/>
                                <Condition Property="LinkLabelBehavior" Value="HoverUnderline"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_InnerHyperlink" Property="TextDecorations" Value="Underline"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="false"/>
                                <Condition Property="LinkLabelBehavior" Value="HoverUnderline"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_InnerHyperlink" Property="TextDecorations" Value="None"/>
                        </MultiTrigger>
                        <Trigger SourceName="PART_InnerHyperlink" Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>